import Cookie from 'react-cookies';
let defaultState={
    auth_token:localStorage['auth_token']?localStorage['auth_token']:'',
    uId:localStorage['uId']?localStorage['uId']:'',
}
function redLogin(state=defaultState, action){
    switch (action.type){
        case 'login':
            localStorage['auth_token']=action.data.auth_token;
            localStorage['uId']=action.data.uId;
            return {...state,...action.data};
        case "outlogin":
            localStorage.clear();
            Cookie.remove('giteCode')
            Cookie.remove('refresh_token')
            Cookie.remove('access_token')
            Cookie.remove('loginType')
            return {...state,...action.data}
        default:
            return state
    }
}
export default redLogin